﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BLL;

namespace Web.admin.CompetitionManage
{
    public partial class AwardLevel : System.Web.UI.Page
    {
        private AwardService award = new AwardService();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                IList<BoAwards> awards = award.GetAllAwards();
                Repeater1.DataSource = awards.ToArray();
                Repeater1.DataBind();
            }
        }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int j = 0;
            for (int i = 0; i < Repeater1.Items.Count; i++)
            {
                string id = ((HiddenField)Repeater1.Items[i].FindControl("Hf_id")).Value;
                CheckBox cb = (CheckBox)Repeater1.Items[i].FindControl("CbChoose");
                if (cb.Checked)
                {
                    BoAwards a = award.GetAward(id);
                    award.DeleteAward(a);
                    j++;
                }
            }
            Response.Write("<script>alert('删除成功，共删除" + j + "条数据');window.location.href='AwardLevel.aspx'; </script>");
            return;
        }
    }
}